<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/lib/Hui-iconfont/1.0.7/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/css/style.css"/>
    <script type="text/javascript" src="/resources/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/resources/lib/util.js"></script>
    <style type="text/css">
        a.dt-button.red {
            color: red;
        }

        a.dt-button.orange {
            color: orange;
        }

        a.dt-button.green {
            color: green;
        }

        .text-c {
            text-align: center;
        }

    </style>
    <title></title>
</head>

<body>
<div class="page-container">

    <div class="row">
        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">用户编码:</label>
            <input type="text" name="userCode" id="userCode" value="$!{userListQO.userCode}"
                   class="input-style col-sm-7 col-xs-12"/>
        </div>
        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">账户Id:</label>
            <input type="text" name="accId" id="accId" value="$!{userListQO.accId}"
                   class="input-style col-sm-7 col-xs-12"/>
        </div>

        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">姓名:</label>
            <input type="text" name="realName" id="realName" value="$!{userListQO.realName}"
                   class="input-style col-sm-7 col-xs-12"/>
        </div>

        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">身份证号:</label>
            <input type="text" name="idNumber" id="idNumber" value="$!{userListQO.idNumber}"
                   class="input-style col-sm-7 col-xs-12"/>
        </div>
        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">注册手机:</label>
            <input type="text" name="phoneNumber" id="phoneNumber" value="$!{userListQO.phoneNumber}"
                   class="input-style col-sm-7 col-xs-12"/>
        </div>
        <div class="col-md-4 col-sm-5 col-xs-12 mb-5">
            <label for="" class="col-sm-5 col-xs-12 text-r">用户状态:</label>
            <select name="blackStatus" id="blackStatus" class="input-style col-md-7 col-xs-12">
                <option value="$!{userListQO.blackStatus}">&#45;&#45;请选择&#45;&#45;</option>
                <option value="0">正常</option>
                <option value="1">锁定</option>
            </select>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-10 col-xs-12 mb-5">
            <label for="" class="col-md-2 col-sm-3 col-xs-12 text-r" style="margin-left: -0.6%">注册时间:</label>
            <input type="text" name="registerTimeStart" id="registerTimeStart"
                   value="$!{userControlListQO.registerTimeStart}"
                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                   class="input-style col-md-3 col-sm-4 col-xs-5"/>
            <label for="" class="text-c" style="float: left">—</label>
            <input type="text" name="registerTimeEnd" id="registerTimeEnd" value="$!{userControlListQO.registerTimeEnd}"
                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                   class="input-style col-md-3 col-sm-4 col-xs-5"/>
        </div>
    </div>

    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>

    #if($shiro.hasPermission("bk:user:search"))
    <div class="row text-c">
        <button type="button" class="btn btn-success size-L radius" id="search_button" name="">
            <i class="Hui-iconfont">&#xe665;</i> 开始查询
        </button>
    </div>
    #end

    <div class="mt-10">
        <table id="table"></table>
    </div>
    <div id="toolbar" class="btn-group">
        #if($shiro.hasPermission("user:list:lock"))
        <button id="btn_lock" type="button" class="btn btn-default">
            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>用户锁定/解锁
        </button>
        #end
        <!--<div type="text" class="btn btn-secondary-outline radius">-->
        <!--<a style="color:black">用户数：</a><span id="userCountNum" aria-hidden="true"></span>-->
        <!--<a style="color:black">个</a>-->
        <!--</div>-->
        <!--<div type="text" class="btn btn-secondary-outline radius">-->
        <!--<a style="color:black">账户余额：</a><span id="accAmountAll" aria-hidden="true"></span>-->
        <!--<a style="color:black">元</a>-->
        <!--</div>-->
    </div>

</div>
<script type="text/javascript" src="/resources/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="/resources/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/resources/static/h-ui.admin/js/H-ui.admin.js"></script>
<script src="/resources/static/h-ui.admin/js/bootstrap-table.min.js"></script>
<script src="/resources/static/h-ui.admin/js/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="/resources/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

    //用户锁定
    $('#btn_lock').on("click", function () {
        checked_data = $('#table').bootstrapTable('getAllSelections', '');//checked 选中
        //判断只有选中一条才可以锁定
        if (checked_data.length == 1) {
            var loadwin = layer.load(1, {
            });
            shade: [0.1,'#fff'] //0.1透明度的白色背景
            $.ajax({
                url: "../user/lock.do?userCode=" + checked_data[0].userCode,
                type: "post",
//                data: checked_data[0].userCode,
                dataType: "json",
                success: function (result) {
                    layer.close(loadwin);
                    if (result.header.re_code == "0000") {
                        layer.msg("操作成功" + result.header.re_num);
                    } else {
                        layer.msg("操作失败" + result.header.re_msg);
                    }
                    $("#search_button").click();
                },
                error: function (result) {
                    layer.close(loadwin);
                    layer.msg("操作失败", "错误原因如下：" + result, {icon: 2, time: 1000});
                    $("#search_button").click();
                }
            });
        } else if (checked_data.length == 0) {
            alert('没有信息被选中');
        } else if (checked_data.length > 1) {
            alert('一次只能选中一条信息');
        }
    })
    /*****************************************************************************************************************************************************/

    $(function () {
        var arr_row = [];
        var tableBoot = $('#table').bootstrapTable({
//            url: '${btnSeach.fun_url}',
//            method: 'GET', //请求方式
            striped: true, //隔行换色
            pagination: true, //启用分页
            search: true, //启用搜索（客户端搜索）
            singleSelect: true, //只能单选
            showRefresh: true, //是否显示刷新按钮
            showToggle: true, //禁止缓存
            cache: false, //禁止缓存
            toolbar: '#toolbar', //指定工具栏
            sortable: true, //是否启用排序
            sortOrder: "desc", //排序方式
            sortName: 'registerTime',
            showColumns: false, //是否显示所有的列
            clickToSelect: true, //点击选中行
            //              后台分页的时候去掉注释
            //              sidePagination: "server", //服务器分页
            //              pageNumber:1,      //初始化加载第一页，默认第一页
            //              pageSize: 10,  //每页条数
            onCheck: function (row, $element) {  //单选 翻页后点击会多选 bug 修复
                arr_row.push($($($element)[0]).attr('data-index'));
                var n;
                if (arr_row.length > 1) {
                    var arr_rows = arr_row.splice(0, arr_row.length - 1);
                    n = arr_rows[arr_rows.length - 1];
                    if (n == arr_row[arr_row.length - 1]) {
                        return
                    }
                    for (var i = 0; i < arr_rows.length; i++) {
                        $("#table").bootstrapTable("uncheck", arr_rows[i]);
                    }
                }
            },
            columns: [{checkbox: true},
                {
                    visible: false,
                    title: "id",
                    field: "id",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "用户编号",
                    field: "userCode",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "账户Id",
                    field: "accId",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "姓名",
                    field: "realName",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "身份证号",
                    field: "idNumber",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "注册手机号",
                    field: "phoneNumber",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "银行卡号",
                    field: "accNumber",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "银行卡名称",
                    field: "bankName",
                    align: 'center',
                    valign: 'center'
                },
                {
                    visible: true,
                    title: "注册时间",
                    field: "registerTime",
                    align: 'center',
                    valign: 'center',
                    sortable: true
                },
                {
                    visible: true,
                    title: "实名时间",
                    field: "realNameTime",
                    align: 'center',
                    valign: 'center',
                    sortable: true
                },
                {
                    visible: true,
                    title: "是否锁定",
                    field: "blackStatus",
                    align: 'center',
                    valign: 'center',
                    formatter: function (value) {
                        if (value == "0") {
                            return "正常";
                        } else if (value == "1") {
                            return "<p style='color:red'>锁定</p>";
                        } else {
                            return value;
                        }
                        ;
                    },
                    sortable: true
                }
            ]
        });

        $("#search_button").click(function () {
            searchWhere = {
                userCode: $("#userCode").val(),
                accId: $("#accId").val(),
                registerTimeStart: $("#registerTimeStart").val(),
                registerTimeEnd: $("#registerTimeEnd").val(),
                phoneNumber: $("#phoneNumber").val(),
                idNumber: $("#idNumber").val(),
                realName: $("#realName").val(),
                accNumber: $("#accNumber").val(),
                blackStatus: $("#blackStatus").val(),
                random: Math.random()
            };

            $.ajax({
                url: "../user/list/search.do",
                type: "post",
                data: searchWhere,
                dataType: "json",
                success: function (result) {
//                    console.log(result);
//                    tableBoot.bootstrapTable('load', result.userListVOlist);
                    tableBoot.bootstrapTable('load', result);
                },
                error: function (result) {
                    layer.msg("未成功查询", "错误原因如下：" + result, {icon: 2, time: 1000});
                }
            });
        });

        #if ($shiro.hasPermission("bk:user:search"))
            $(document).keydown(function (event) {
                if (event.keyCode == 13) {
                    $("#search_button").trigger("click");
                }
            });

        $(document).ready(function () {
            $("#search_button").click();
        });
        #end

    })
</script>
</body>
</html>
